package strauss.flatland.things;

import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.List;

import strauss.flatland.things.geometry.Vertex;
import strauss.flatland.things.geometry.GeometricVector;
import strauss.flatland.things.geometry.VertexMath;

public class Line extends Thing {
	private Vertex start;
	private Vertex end;
	public Line(Vertex start, Vertex end, GeometricVector momentum) {
		super(momentum);
		this.start=start;
		this.end=end;
	}
	
	public double getMass() {
		return Double.MAX_VALUE;
	}

	@Override
	public List<Vertex> getCoordinates() {
		List<Vertex> coordinates = new ArrayList<Vertex>();
		coordinates.add(start);
		coordinates.add(end);
		return coordinates;
	}
	
	public Vertex getStart() {
		return start;
	}
	
	public Vertex getEnd() {
		return end;
	}

	@Override
	public void update() {
		// TODO Auto-generated method stub
		
	}

	public boolean contains(Point2D arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean contains(Rectangle2D arg0) {
		Path2D.Double path = new Path2D.Double();
		path.moveTo(start.getX(), start.getY());
		path.lineTo(end.getX(), end.getY());
		path.closePath();
		return path.contains(arg0);
	}

	public boolean contains(double arg0, double arg1) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean contains(double arg0, double arg1, double arg2, double arg3) {
		// TODO Auto-generated method stub
		return false;
	}

	public Rectangle getBounds() {
		// TODO Auto-generated method stub
		return null;
	}

	public Rectangle2D getBounds2D() {
		Path2D.Double path = new Path2D.Double();
		path.moveTo(start.getX(), start.getY());
		path.lineTo(end.getX(), end.getY());
		path.closePath();
		return path.getBounds2D();
	}

	public PathIterator getPathIterator(AffineTransform arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	public PathIterator getPathIterator(AffineTransform arg0, double arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean intersects(Rectangle2D arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean intersects(double arg0, double arg1, double arg2, double arg3) {
		// TODO Auto-generated method stub
		return false;
	}

	public Vertex getCenterOfGravity() {
		return VertexMath.calcMidPoint(start, end);
	}

	public double getElasticity() {
		return 1;
	}
}
